package com.zqxq.lottery.api.controller;

import com.baomidou.mybatisplus.plugins.Page;
import com.zqxq.common.constant.Result;
import com.zqxq.lottery.api.feign.LotteryServerFeignClient;
import com.zqxq.lottery.entity.bo.sys.SysMsgCMSBO;
import com.zqxq.lottery.entity.bo.user.UserMsgBO;
import com.zqxq.lottery.entity.vo.sys.SysMsgVO;
import com.zqxq.lottery.entity.vo.user.UserMsgVO;
import com.zqxq.lottery.entity.vo.user.UserWindowMsgVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description ：
 * @Author ： 解风
 * @Date ： 2018/03/22 11:02
 */
@Api(value = "消息接口",tags = "消息接口")
@RestController
@Slf4j
@RequestMapping(value = "/msg", produces = "application/json")
public class MsgController {

    @Autowired
    private LotteryServerFeignClient lotteryServerFeignClient;

    @ApiOperation("分页获取消息列表")
    @PostMapping("/queryPageList")
    public Result<Page<SysMsgVO>> queryMsgPageList(SysMsgCMSBO baseBO){
        baseBO.setStatus(1);
        return lotteryServerFeignClient.queryMsgPageList(baseBO);
    }

    @ApiOperation("用户信息列表")
    @PostMapping("/user/page")
    public Result<Page<UserMsgVO>> queryUserMsgPage(UserMsgBO search){
        return lotteryServerFeignClient.queryUserMsgPage(search);
    }

    @ApiOperation("用户是否有新消息")
    @PostMapping("/user/new")
    public Result queryUserMsgNew(String userId){
        return lotteryServerFeignClient.queryUserMsgNew(userId);
    }

    @ApiOperation("获取首页弹窗消息列表")
    @PostMapping("/queryWindowList")
    public Result<List<UserWindowMsgVO>> queryWindowList(String userId){
        return lotteryServerFeignClient.queryWindowList(userId);
    }

    @ApiOperation("标记消息为已读")
    @PostMapping("/updateWindowMsg")
    public Result updateWindowMsg(String ids){
        return lotteryServerFeignClient.updateWindowMsg(ids);
    }


}
